﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class StartForm : Form
    {
        public StartForm()
        {
            InitializeComponent();
        }

        private void StartForm_Load(object sender, EventArgs e)
        {
            MessageBox.Show("Уважаемый студент! Сейчас Вам предстоит пройти тестирование по одному из выбранных Вами предметов. В конце теста Вы узнаете свой результат. Желаем успехов!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        private void btn_Continue_Click(object sender, EventArgs e)
        {
            if (mtb_Surname.Text.Length == 0 || mtb_Name.Text.Length == 0)
            {
                MessageBox.Show("Заполните все поля!", " ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else 
            {
                Person currentPerson = new Person(mtb_Surname.Text, mtb_Name.Text);
                Subject currentSubject = new Subject();
                if (rbt_Economics.Checked)
                {
                    currentSubject = new Subject("../../macroeconomics.txt", "Экономика");
                }
                if (rbt_English.Checked)
                {
                    currentSubject = new Subject("../../english.txt", "Английский язык");
                }
                if (rbt_Math.Checked)
                {
                    currentSubject = new Subject("../../math.txt", "Математика");
                }
                Operations currentOperation = new Operations(currentSubject);
                this.Hide();
                MainForm mf = new MainForm(currentOperation, currentPerson, currentSubject);
                mf.Show();
            }
        }

        private void mtb_Surname_MouseClick(object sender, MouseEventArgs e)
        {
            mtb_Surname.SelectionStart = mtb_Surname.Text.Length;
        }

        private void mtb_Name_MouseClick(object sender, MouseEventArgs e)
        {
            mtb_Name.SelectionStart = mtb_Name.Text.Length;
        }
    }
}
